﻿/*******************************************************************************
 
 * Author: Dealin
 
 
*********************************************************************************/
using Dealin.Application.DeviceManage;
using Dealin.Code;
using Dealin.Domain.Entity.DeviceManage;
using System.Web.Mvc;
namespace Dealin.Web.Areas.DeviceManage.Controllers
{
    public class BatteryController : ControllerBase
    {
        private BatteryApp app = new BatteryApp();
        
        [HttpGet]
        [HandlerAjaxOnly]
        public ActionResult GetGridJson(string keyword)
        {
            var data = app.GetList(keyword);
            return Content(data.ToJson());
        }
        [HttpGet]
        [HandlerAjaxOnly]
        public ActionResult GetFormJson(string keyValue)
        {
            var data = app.GetForm(keyValue);
            return Content(data.ToJson());
        }
        [HttpPost]
        [HandlerAjaxOnly]
        [ValidateAntiForgeryToken]
        public ActionResult SubmitForm(BatteryEntity entity,  string keyValue)
        {
            app.SubmitForm(entity, keyValue);
            return Success("操作成功。");
        }
        [HttpPost]
        [HandlerAjaxOnly]
        [HandlerAuthorize]
        [ValidateAntiForgeryToken]
        public ActionResult DeleteForm(string keyValue)
        {
            app.DeleteForm(keyValue);
            return Success("删除成功。");
        }
    }
}
